Skip to content

Fix NuGet trusted publishing: remove manual OIDC token fetch#40

Merged
dampee merged 2 commits into
mainfrom
claude/vibrant-elion-10a4d8
Jun 14, 2026
Merged

Fix NuGet trusted publishing: remove manual OIDC token fetch#40
dampee merged 2 commits into
mainfrom
claude/vibrant-elion-10a4d8

Conversation

@dampee

@dampee dampee commented Jun 14, 2026

Copy link
Copy Markdown
Member

Summary

Why

Passing the raw GitHub OIDC JWT directly as --api-key doesn't work — NuGet returns 403. The NuGet CLI (6.8+, bundled with .NET 8 SDK) performs the OIDC token exchange internally when id-token: write is granted and no --api-key is provided. The ACTIONS_ID_TOKEN_REQUEST_URL / ACTIONS_ID_TOKEN_REQUEST_TOKEN env vars are set automatically by the runner and the NuGet CLI uses them to fetch and exchange the token transparently.

Test plan

  • Merge to main and confirm the publish job completes without 403

🤖 Generated with Claude Code

Passing the raw GitHub OIDC JWT as --api-key doesn't work — NuGet
rejects it with 403. The NuGet CLI (6.8+, bundled with .NET 8 SDK)
performs the OIDC token exchange internally when id-token: write is
set and no --api-key is provided.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Copilot AI review requested due to automatic review settings June 14, 2026 20:26
The official NuGet/login action exchanges the GitHub OIDC token for a
short-lived nuget.org API key and exposes it as NUGET_API_KEY.
Requires a NUGET_USER repo secret (value: dampeebe).
The .snupkg symbol packages are pushed automatically alongside .nupkg.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR updates the NuGet publishing workflow to rely on NuGet/.NET’s built-in trusted publishing (OIDC) flow instead of manually fetching an OIDC JWT and passing it as an API key. This aligns the pipeline with how dotnet nuget push performs the OIDC token exchange when id-token: write is granted and no --api-key is supplied.

Changes:

  • Removes the actions/github-script step that fetched an OIDC token for api.nuget.org.
  • Removes passing the fetched token via --api-key to dotnet nuget push, leaving push commands to run without an API key.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

@dampee
dampee merged commit ae9394d into main Jun 14, 2026
2 checks passed
@dampee
dampee deleted the claude/vibrant-elion-10a4d8 branch June 14, 2026 20:28
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants